// 引入自定义模块
// const {average, max} = require('./arr-utils.js')
import {max, average} from './arr-utils.js'  // {max, average, default: {max, average}}
import * as arrUtils from './arr-utils.js'
import arrUtils2 from './arr-utils.js'

console.log('arrUtils', arrUtils)
console.log('arrUtils2', arrUtils2)

// 引入第三方模块(下载的)
// const uniq = require('uniq')
// import {default as uniq2} from '../lib/uniq'
import uniq from '../lib/uniq.js'  // 默认引入 uniq是default属性的别名(可以随便取名)

console.log(average([1, 5, 3]))
console.log(max([1, 5, 3]))
// uniq的功能: 去重 + 排序
console.log(uniq([7, 1, 5, 3, 5, 1, 6])) // [ 1, 3, 5, 6, 7 ]

document.getElementById('btn').onclick = () => {
  alert(Math.floor(Math.random()*100))
}